Skip to content

Commit

Permalink
apk expansion 속성을 조정할수 있도록
Browse files Browse the repository at this point in the history
gear vr에서는 끄고싶고 daydream에서는 켜고싶어서
  • Loading branch information
if1live committed Aug 2, 2017
1 parent d9ce4ff commit 77d498d
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 17 deletions.
7 changes: 7 additions & 0 deletions UnityProject_Minamo/Assets/Minamo/Editor/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ AnyDictionary Defines
get { return new AnyDictionary(root.GetList("defines")); }
}

AnyDictionary Publishing
{
get { return new AnyDictionary(root.GetDict("publishing")); }
}

internal Config(string jsontext) {
var d = jsontext.FromJson<object>() as Dictionary<string, object>;
root = new AnyDictionary(d);
Expand Down Expand Up @@ -76,6 +81,7 @@ ModifierTuple[] CreateConfigBased(BuildTargetGroup targetGroup) {
new ModifierTuple(new Modifier_VRDevice(targetGroup), VRDevices),
new ModifierTuple(new Modifier_Keystore(), Keystore),
new ModifierTuple(new Modifier_DefineSymbol(targetGroup), Defines),
new ModifierTuple(new Modifier_Publishing(), Publishing),
};
}

Expand All @@ -87,6 +93,7 @@ ModifierTuple[] CreateCurrentBased(BuildTargetGroup targetGroup) {
new ModifierTuple(Modifier_VRDevice.Current(targetGroup), VRDevices),
new ModifierTuple(Modifier_Keystore.Current(), Keystore),
new ModifierTuple(Modifier_DefineSymbol.Current(targetGroup), Defines),
new ModifierTuple(Modifier_Publishing.Current(), Publishing),
};
}

Expand Down
29 changes: 29 additions & 0 deletions UnityProject_Minamo/Assets/Minamo/Editor/Modifier_Publishing.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System.Text;
using UnityEditor;

namespace Assets.Minamo.Editor {
class Modifier_Publishing : IModifier {
bool useApkExpansion;

public void Apply() {
PlayerSettings.Android.useAPKExpansionFiles = useApkExpansion;
}

public void Reload(AnyDictionary dict) {
useApkExpansion = dict.GetValue<bool>("useApkExpansion");
}

internal static Modifier_Publishing Current() {
return new Modifier_Publishing()
{
useApkExpansion = PlayerSettings.Android.useAPKExpansionFiles,
};
}

public string GetConfigText() {
var sb = new StringBuilder();
sb.AppendFormat("useApkExpansion={0}", useApkExpansion);
return sb.ToString();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ type KeystoreConfig struct {
KeyaliasPass string `json:"keyaliasPass"`
}

type PublishingConfig struct {
UseApkExpansion bool `json:"useApkExpansion"`
}

type Config struct {
UnityPath string `json:"unityPath"`
ProjectPath string `json:"projectPath"`
Expand All @@ -65,6 +69,7 @@ type Config struct {
VRDevices VRDevicesConfig `json:"vrDevices"`
AndroidSDK AndroidSDKConfig `json:"androidSdk"`
Keystore KeystoreConfig `json:"keystore"`
Publishing PublishingConfig `json:"publishing"`

// extra field
FileName string
Expand Down
24 changes: 12 additions & 12 deletions config_test.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package main

import "testing"
import "path/filepath"

func Test_loadConfig(t *testing.T) {
cases := []struct {
filename string
filepath string
}{
{"android_daydream_dev.json"},
{"android_gearvr_dev.json"},
{"android_gearvr_release.json"},
{"ios_dev.json"},
{"standalone_win_dev.json"},
{"vr_win32_oculus_dev.json"},
{"vr_win32_steamvr_dev.json"},
{"win32_custom.json"},
{"configs/android_daydream_dev.json"},
{"configs/android_gearvr_dev.json"},
{"configs/android_gearvr_release.json"},
{"configs/ios_dev.json"},
{"configs/standalone_win_dev.json"},
{"configs/vr_win32_oculus_dev.json"},
{"configs/vr_win32_steamvr_dev.json"},
{"configs/win32_custom.json"},

{"configs_dev/local.json"},
}
for _, c := range cases {
fp := filepath.Join("configs", c.filename)
_, err := loadConfig(fp, "")
_, err := loadConfig(c.filepath, "")
if err != nil {
t.Fatalf("loadConfig[%s]: %v, ", c, err)
}
Expand Down
29 changes: 24 additions & 5 deletions configs_dev/local.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"target": "windows",

"options": {
"development": false,
"development": true,
"allowDebugging": true
}
},
Expand All @@ -24,10 +24,29 @@

"vrDevices": {
"enabled": true,
"devices": "OpenVR"
},

"stereoRenderingPath": {
"devices": "OpenVR",
"stereoRenderingPath": "single-pass"
},

"identification": {
"packageName": "com.fiveminlab.minamo.localdev",
"versionName": "0.0.1",
"versionCode": 1
},

"androidSdk": {
"min": 24,
"target": 0
},

"keystore": {
"keystoreName": "",
"keystorePass": "",
"keyaliasName": "",
"keyaliasPass": ""
},

"publishing": {
"useApkExpansion": true
}
}

0 comments on commit 77d498d

Please sign in to comment.