Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for JavaCompile in vsandroid #1203

Merged
merged 1 commit into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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