Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
P
package-framework
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AnarchyTools
package-framework
Commits
5ba88884
Commit
5ba88884
authored
May 11, 2016
by
Drew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iOS (simulator) support
parent
5d3deec9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
25 deletions
+76
-25
build.atpkg
build.atpkg
+6
-0
src/main.swift
src/main.swift
+70
-25
No files found.
build.atpkg
View file @
5ba88884
...
...
@@ -50,6 +50,12 @@
:osxcheck {
:tool "shell"
:script "cd tests/osx && ~/Code/AnarchyTools/atbuild/bin/atbuild --toolchain xcode check"
:dependencies ["default"]
}
:ioscheck {
:tool "shell"
:script "cd tests/ios && ~/Code/AnarchyTools/atbuild/bin/atbuild --toolchain xcode --platform ios check"
:dependencies ["default"]
}
:check {
...
...
src/main.swift
View file @
5ba88884
...
...
@@ -39,15 +39,17 @@ func arg(_ larg: String) -> String? {
class
PackageFramework
{
func
run
()
{
guard
let
p
latform
=
env
(
"ATBUILD_PLATFORM"
)
else
{
guard
let
atbuildP
latform
=
env
(
"ATBUILD_PLATFORM"
)
else
{
fatalError
(
"Set $ATBUILD_PLATFORM"
)
}
let
architecture
:
String
switch
(
p
latform
)
{
let
platformToArch
:
[
String
:
String
]
switch
(
atbuildP
latform
)
{
case
"osx"
:
architecture
=
"x86_64"
platformToArch
=
[
"osx"
:
"x86_64"
]
case
"ios"
:
platformToArch
=
[
"ios-arm64"
:
"arm64"
,
"ios-armv7"
:
"armv7"
,
"ios-i386"
:
"i386"
,
"ios-x86_64"
:
"x86_64"
]
default
:
fatalError
(
"Unsupported platform
\(
p
latform
)
"
)
fatalError
(
"Unsupported platform
\(
atbuildP
latform
)
"
)
}
guard
let
name
=
arg
(
Options
.
Name
.
rawValue
)
else
{
...
...
@@ -57,7 +59,9 @@ class PackageFramework {
guard
let
infoPlist
=
arg
(
Options
.
InfoPlist
.
rawValue
)
else
{
fatalError
(
"Specify a
\(
Options
.
InfoPlist
.
rawValue
)
"
)
}
var
resources
:
[
String
]
=
[
infoPlist
]
//rm framework if it exists
let
frameworkPath
=
Path
(
"bin/
\(
name
)
.framework"
)
...
...
@@ -65,43 +69,84 @@ class PackageFramework {
let
_
=
try
?
FS
.
createDirectory
(
path
:
frameworkPath
)
//'a' version
let
relativeAVersionPath
=
Path
(
"Versions/A"
)
let
AVersionPath
=
frameworkPath
+
relativeAVersionPath
try!
FS
.
createDirectory
(
path
:
AVersionPath
,
intermediate
:
true
)
//'current' (produces code signing failures if absent)
try!
FS
.
symlinkItem
(
from
:
Path
(
"A"
),
to
:
frameworkPath
+
"Versions/Current"
)
let
relativeAVersionPath
:
Path
!
let
AVersionPath
:
Path
switch
(
atbuildPlatform
)
{
case
"osx"
:
relativeAVersionPath
=
Path
(
"Versions/A"
)
AVersionPath
=
frameworkPath
+
relativeAVersionPath
case
"ios"
:
relativeAVersionPath
=
nil
AVersionPath
=
frameworkPath
default
:
fatalError
(
"Unsupported platform
\(
atbuildPlatform
)
"
)
}
if
atbuildPlatform
==
"osx"
{
try!
FS
.
createDirectory
(
path
:
AVersionPath
,
intermediate
:
true
)
//'current' (produces code signing failures if absent)
try!
FS
.
symlinkItem
(
from
:
Path
(
"A"
),
to
:
frameworkPath
+
"Versions/Current"
)
}
print
(
"a"
)
//copy payload
//atbin path
let
atbinPath
=
Path
(
env
(
"ATBUILD_BIN_PATH"
)
!
)
.
appending
(
"
\(
name
)
.atbin"
)
let
payloadPath
=
atbinPath
.
appending
(
name
+
".dylib"
)
print
(
"copy
\(
payloadPath
)
\(
AVersionPath
.
appending
(
name
)
)
"
)
try!
FS
.
copyItem
(
from
:
payloadPath
,
to
:
AVersionPath
.
appending
(
name
))
try!
FS
.
symlinkItem
(
from
:
relativeAVersionPath
.
appending
(
name
),
to
:
frameworkPath
.
appending
(
name
))
print
(
"b"
)
if
atbuildPlatform
==
"osx"
{
try!
FS
.
symlinkItem
(
from
:
relativeAVersionPath
.
appending
(
name
),
to
:
frameworkPath
.
appending
(
name
))
}
//copy modules
let
modulePath
=
AVersionPath
.
appending
(
"Modules"
)
.
appending
(
name
+
".swiftmodule"
)
try!
FS
.
createDirectory
(
path
:
modulePath
,
intermediate
:
true
)
let
swiftModulePath
=
atbinPath
.
appending
(
"
\(
platform
)
.swiftmodule"
)
if
FS
.
fileExists
(
path
:
swiftModulePath
)
{
try!
FS
.
copyItem
(
from
:
swiftModulePath
,
to
:
modulePath
.
appending
(
"
\(
architecture
)
.swiftmodule"
))
for
(
platform
,
architecture
)
in
platformToArch
{
let
swiftModulePath
=
atbinPath
.
appending
(
"
\(
platform
)
.swiftmodule"
)
if
FS
.
fileExists
(
path
:
swiftModulePath
)
{
try!
FS
.
copyItem
(
from
:
swiftModulePath
,
to
:
modulePath
.
appending
(
"
\(
architecture
)
.swiftmodule"
))
}
let
swiftDocPath
=
atbinPath
.
appending
(
"
\(
platform
)
.swiftdoc"
)
if
FS
.
fileExists
(
path
:
swiftDocPath
)
{
try!
FS
.
copyItem
(
from
:
swiftDocPath
,
to
:
modulePath
.
appending
(
"
\(
architecture
)
.swiftdoc"
))
}
}
let
swiftDocPath
=
atbinPath
.
appending
(
"
\(
platform
)
.swiftdoc"
)
if
FS
.
fileExists
(
path
:
swiftDocPath
)
{
try!
FS
.
copyItem
(
from
:
swiftDocPath
,
to
:
modulePath
.
appending
(
"
\(
architecture
)
.swiftdoc"
))
print
(
"c"
)
if
atbuildPlatform
==
"osx"
{
try!
FS
.
symlinkItem
(
from
:
relativeAVersionPath
.
appending
(
"Modules"
),
to
:
frameworkPath
.
appending
(
"Modules"
))
}
try!
FS
.
symlinkItem
(
from
:
relativeAVersionPath
.
appending
(
"Modules"
),
to
:
frameworkPath
.
appending
(
"Modules"
))
//copy resources
let
resourcesPath
=
AVersionPath
.
appending
(
"Resources"
)
try!
FS
.
createDirectory
(
path
:
resourcesPath
,
intermediate
:
true
)
let
resourcesPath
:
Path
switch
(
atbuildPlatform
)
{
case
"osx"
:
resourcesPath
=
AVersionPath
.
appending
(
"Resources"
)
case
"ios"
:
resourcesPath
=
AVersionPath
default
:
fatalError
(
"Unsupported platform
\(
atbuildPlatform
)
"
)
}
do
{
try
FS
.
createDirectory
(
path
:
resourcesPath
,
intermediate
:
true
)
}
catch
SysError
.
FileExists
{
/* */
}
catch
{
fatalError
(
"
\(
error
)
"
)}
for
resource
in
resources
{
print
(
"f
\(
resource
)
\(
resourcesPath
)
"
)
try!
FS
.
copyItem
(
from
:
Path
(
resource
),
to
:
resourcesPath
+
resource
)
}
try!
FS
.
symlinkItem
(
from
:
relativeAVersionPath
+
"Resources"
,
to
:
frameworkPath
+
"Resources"
)
if
atbuildPlatform
==
"ios"
{
try!
FS
.
copyItem
(
from
:
Path
(
infoPlist
),
to
:
AVersionPath
.
appending
(
"Info.plist"
))
}
print
(
"e"
)
if
atbuildPlatform
==
"osx"
{
try!
FS
.
symlinkItem
(
from
:
relativeAVersionPath
+
"Resources"
,
to
:
frameworkPath
+
"Resources"
)
}
print
(
"d"
)
//codesign
let
cmd
=
"codesign --force --deep --sign - --timestamp=none '
\(
AVersionPath
)
'"
print
(
cmd
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment