Skip to content

Commit

Permalink
Merge pull request #1203 from tempura-sukiyaki/vsandroid-javacompile
Browse files Browse the repository at this point in the history
Add support for JavaCompile in vsandroid
  • Loading branch information
samsinsane authored Dec 6, 2018
2 parents 0f0c1d1 + 0002511 commit 6e380c0
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/android/tests/_tests.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require ("android")

return {
"test_android_project.lua"
"test_android_files.lua",
"test_android_project.lua",
}
47 changes: 47 additions & 0 deletions modules/android/tests/test_android_files.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
local p = premake
local suite = test.declare("test_android_files")
local vc2010 = p.vstudio.vc2010


--
-- Setup
--

local wks, prj

function suite.setup()
p.action.set("vs2015")
wks = test.createWorkspace()
end

local function prepare()
prj = test.getproject(wks, 1)
system "android"
vc2010.files(prj)
end


--
-- Test filtering of source files into the correct categories.
--

function suite.none_onJavaFile()
files { "hello.java" }
prepare()
test.capture [[
<ItemGroup>
<None Include="hello.java" />
</ItemGroup>
]]
end

function suite.javaCompile_onJavaFile()
kind "androidproj"
files { "hello.java" }
prepare()
test.capture [[
<ItemGroup>
<JavaCompile Include="hello.java" />
</ItemGroup>
]]
end
16 changes: 16 additions & 0 deletions modules/android/vsandroid_androidproj.lua
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,19 @@
end
}

vc2010.categories.JavaCompile = {
name = "JavaCompile",
priority = 99,

emitFiles = function(prj, group)
vc2010.emitFiles(prj, group, "JavaCompile", {vc2010.generatedFile, android.link})
end,

emitFilter = function(prj, group)
vc2010.filterGroup(prj, group, "JavaCompile")
end
}

vc2010.categories.Content = {
name = "Content",
priority = 99,
Expand All @@ -239,13 +252,16 @@
end

local filename = path.getname(file.name):lower()
local extension = path.getextension(filename)

if filename == "androidmanifest.xml" then
return vc2010.categories.AndroidManifest
elseif filename == "build.xml" then
return vc2010.categories.AntBuildXml
elseif filename == "project.properties" then
return vc2010.categories.AntProjectPropertiesFile
elseif extension == ".java" then
return vc2010.categories.JavaCompile
else
return vc2010.categories.Content
end
Expand Down

0 comments on commit 6e380c0

Please sign in to comment.